<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>提示</title>
    <style>
        * {
            margin: 0;
            padding: 0;
        }

        .tishi {
            text-align: midle;
            font-size: 12px;
            line-height: 103px;
            text-align: center;
        }

        .tishi img {
            height: 33px;
            width: 32px;
        }

        .bth {
            background-color: #f0f0f0;
            height: 50px;
            display: flex;
            justify-content: flex-end;
            align-items: center;
            padding: 0 5px;
        }

        button {
            border-radius: 5px;
            background-color: #fdfdfd;
            width: 85px;
            line-height: 25px;
            height: 25px;
            font-size: 12px;
            border: 1px solid transparent;
            margin-right: 15px;
        }

        button:hover {
            background-color: #e0eef9;
            border-color: #58a4de;
        }
    </style>
</head>

<body>
    <div class="tishi">
        <img src="..\img\警告.jpg">
        <span>程序即将退出，您确定要退出软件?</span>
    </div>
    <div class="bth">
        <button id="yes">是(Y)</button>
        <button id="no">否(N)</button>
    </div>
</body>

</html>
<script>
    const { ipcRenderer } = require('electron');
    let yes = document.getElementById('yes');
    let no = document.getElementById('no');
    yes.onclick = function () {
        ipcRenderer.send('close-main-window');
        window.close();
    }
    no.onclick = function () {
        window.close();
    }
    document.addEventListener('keydown', function (event) {
        if (event.key === 'n' || event.key === 'N' || event.keyCode === 78) {
            window.close();
        }
        if (event.key === 'y' || event.key === 'Y' || event.keyCode === 89) {
            ipcRenderer.send('close-main-window');
            window.close();
        }
    });
</script>